package com.woniuxy.goods.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniuxy.goods.mapper.PointsMapper;
import com.woniuxy.goods.service.PointsService;
import com.woniuxy.goods.vo.BuyGoodsVo;
import com.woniuxy.goods.vo.PointsRecordVo;
import com.woniuxy.goods.vo.PointsVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class PointsServiceImpl implements PointsService {

    @Resource
    private PointsMapper pointsMapper;

    @Override
    public PageInfo<PointsVo> findAll(Integer currentPage, Integer pageSize, String name) {
        PageHelper.startPage(currentPage, pageSize);
        List<PointsVo> list = pointsMapper.findAll(name);
        PageInfo<PointsVo> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public PointsVo findById(Integer uid) {
        return pointsMapper.findById(uid);
    }

    @Override
    public void edit(BuyGoodsVo buyGoodsVo) {
        pointsMapper.edit(buyGoodsVo);
    }

    @Override
    public PageInfo<PointsRecordVo> findpointsRecord(Integer currentPage, Integer pageSize, String name) {
        PageHelper.startPage(currentPage, pageSize);
        List<PointsRecordVo> list = pointsMapper.findpointsRecord(name);
        PageInfo<PointsRecordVo> pageInfo = new PageInfo<>(list);
        return pageInfo;

    }


}
